<script type="text/javascript">
	$(document).ready(function() {
		$('#sponsorlist').tablesorter({
			widthFixed: true,
			widgets: ['zebra']
		}).tablesorterPager({
			container: $(".pager")
		});
	});

	function gotoeditpage(id) {
		var url = "<?php echo site_url($role.'/sponsor/edit').'/'; ?>" + id;
		document.location.href = url;
	}
</script>

<div id="main-content" class="prepend-1 span-19 last">
<?php 
	if ($addstatus == 'success') {
		echo '<span class="info">Sponsor berhasil ditambahkan.</span>';
		echo '<div class="clear">'.nbs().'</div>';	
	}
	if ($editstatus == 'success') {
		echo '<span class="info">Sponsor berhasil diedit.</span>';
		echo '<div class="clear">'.nbs().'</div>';
	}
?>
	<h3>Daftar Sponsor</h3>
	<h4>Form Pencarian Sponsor</h4>
<?php echo form_open($role.'/sponsor/index', array('method' => 'get', 'class' => 'form')); ?>
	<table>
		<tr>
			<td width="200"><label>Nama Sponsor</label></td>
			<td><input type="text" name="name" id="name" maxlength="64" style="width: 400px!important" value="<?php echo ext_set_value('name'); ?>" /></td>
		</tr>
	</table>
	<input type="submit" name="search" value="Cari" class="submit" />
<?php echo form_close(); ?>
	<div class="clear"><?php echo nbs(); ?></div>
	<h4><?php echo $title; ?></h4>
	<table id="sponsorlist">
	<thead>
		<tr>
			<th width="200">Nama Sponsor</th>
			<th width="300">Alamat Sponsor</th>
			<th width="200">Nama Kontak</th>
			<th width="200">Nomor Kontak</th>
			<th width="100">Operasi</th>
		</tr>
	</thead>
	<tfoot>
		<?php echo $pager; ?>
	</tfoot>
	<tbody>
<?php 
	if ($sponsors == NULL) : 
?>
		<tr>
			<td align="center" colspan="5">
				<span class="info"><?php echo $empty; ?></span>
			</td>
		</tr>
<?php 
	else :
		foreach ($sponsors as $sponsor) :	
?>
		<tr>
			<td><?php echo anchor($role.'/sponsor/detail/'.$sponsor->id, $sponsor->name); ?></td>
			<td><?php echo $sponsor->address; ?></td>
			<td><?php echo $sponsor->contact_name; ?></td>
			<td><?php echo $sponsor->contact_no; ?></td>
			<td align="center"><input value="Edit" type="button" class="submit" name="edit" id="edit" onclick="gotoeditpage('<?php echo $sponsor->id; ?>')" /></td>
		</tr>
<?php 
		endforeach;
	endif;
?>
	</tbody>
	</table>
	<div class="clear"><?php echo nbs(); ?></div>
</div>